<cfparam name="f" default="docs">
<cfparam name="dir" default="/">
<cfparam name="page_content" default=" ">
<cfparam name="page_name" default="New Page">
<cffile action="read" file="#request.adminpath##f##dir##page_name#" variable="page_content">
<cfif isdefined('form.page_content')>
  <cfset waserror = 0>
  <cffile action="write" output="#form.page_content#" file="#request.adminpath##f##dir##page_name#">
  <cfinvoke component="cfcs.common.shared" method="redirect" url="index.cfm?c=admindocs&dir=#dir#&f=#f#" msg="Page has been saved." />
</cfif>

<cfif NOT isdefined('waserror')>
  <cfoutput>
    <form id="theForm" method="post" action="index.cfm?c=admindocs&a=edit&f=#f#&dir=#dir#">
      <input name="dir" value="#dir#" type="hidden" />
      <input name="f" value="#f#" type="hidden" />
      Name:
      <input name="page_name" type="hidden" value="#page_name#" size="60" maxlength="55">
      #page_name#&nbsp;&nbsp;
      <input type="submit" value="Save Page" Name="abutton" id="abutton" class="abutton">
      &nbsp;&nbsp;<a href = "index.cfm?c=admindocs&a=default&f=#f#">Back to pages</a>
      <textarea name="page_content" id="page_content" style="width: 100%; height: 400px;" class="tinymce">#page_content#</textarea>
    </form>
  </cfoutput>
</cfif>
<script language="javascript">
var NS = (navigator.appName=="Netscape")?true:false; 
iHeight = (NS)?window.innerHeight:document.body.clientHeight;
iHeight = iHeight - 75; 
document.getElementById('page_content').style.height = iHeight + 'px';
</script>
